package cz.muni.fi.pa165.service.local;

import cz.muni.fi.pa165.dto.CustomerDTO;
import java.util.List;
import javax.ejb.Local;

/**
 *
 * @author Jakub Janco
 */
@Local
public interface CustomerServiceLocal {
    /**
     * Stores new customer into database.
     * 
     * @param customer New customer to add into database.
     * @return Long id of created customer
     * @throws IllegalArgumentException if customer is null, customer's id is not null, any other customer's attribute is null or 
     * empty and if address is not in form: "Street number, City, ZIPCode"
     */
    public Long createCustomer(CustomerDTO customer);
    
    /**
     * Removes customer from database.
     * 
     * @param customer Customer to remove from database.
     * @throws IllegalArgumentException if customer is null, id is null and any customer's attribute is inconsistent with DB 
     * customer's attribute.
     */
    public void removeCustomer(CustomerDTO customer);
    
    /**
     * Updates customer in database.
     * 
     * @param customer CustomerDTO to update from database.
     * @throws IllegalArgumentException if customer is null, id is null, any other customer's attribute is null or empty and if 
     * address is not in form: "Street number, City, ZIPCode"
     */
    public void updateCustomer(CustomerDTO customer);
    
    /**
     * Returns list of all customers.
     * 
     * @return List<CustomerDTO> list of all customers
     */
    public List<CustomerDTO> getAllCustomers();        
    
    /**
     * Returns customer with given id from database.
     * 
     * @param id customer's id 
     * @return Customer with given id
     */
    public CustomerDTO getCustomerById(Long id); 
}
